'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { INTEGER, STRING, DATE, ENUM } = Sequelize;
    // 创建表
    await queryInterface.createTable('swiper', {
      id: {
        type: INTEGER(20).UNSIGNED,
        primaryKey: true,
        autoIncrement: true
      },
      image: {
        type: STRING(160),
        allowNull: false,
        defaultValue: '',
        comment: '图片',
        unique: true
      },
      link: {
        type: STRING(160),
        allowNull: false,
        defaultValue: '',
        comment: '跳转链接',
      },
      order: {
        type: INTEGER(20),
        comment: '排序值',
        unique: true
      },
      created_at: DATE,
      updated_at: DATE
    });
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('swiper');
  }
};